home *** CD-ROM | disk | FTP | other *** search
- /*
- * @(#)tex.h 2.6 EPA
- *
- * Copyright 1987,1988 Pat J Monardo
- *
- * Redistribution of this file is permitted through
- * the specifications in the file COPYING.
- *
- *
- */
-
- #include <stdio.h>
- #include <signal.h>
- #include <time.h>
- /*#include <sys/time.h>*/
-
- /*
- * constants in the outer block
- */
-
- #define NUL '\0'
- #define EOLN '\n'
- #define FALSE 0
- #define TRUE 1
- #define EMPTY 0
-
- /*
- * Configurable Parameters: (++jrb bammi@dsrgsun.ces.cwru.edu)
- * Please read and understand the meaning of each paramter, and its
- * relationship to other parameters, before randomly changing values
- * (which in my experience is the cause of 99% of the problems people
- * have in TeX, rather than the program itself.) Please note: the type of
- * `hword' below. Depending on how you set the parameter value, it may
- * need to be changed from a type `unsigned short' to a type `unsigned long'.
- * When you do that, you need to also re-compile and initex, and run it
- * to get new `.fmt' files, otherwise virtex will complain about format
- * file errors.
- * (all xxx_MIN's are always 0 in this implementation)
- * MEM_MAX greatest index in TeX's internal mem array.
- * MEM_MAX < MEM_TOP in initex
- * MEM_MAX >= MEM_TOP in virtex
- *
- * BUF_SIZE max number of characters simultaneously present in current
- * linesof open files.
- * BUF_SIZ <= MAX_HALFWORD
- *
- * ERROR_LINE width of context lines on error message
- *
- * HALF_ERROR_LINE width of first lines of context on error messages
- * 30 < HALF_ERROR_LINE < (ERROR_LINE - 15)
- *
- * MAX_PRINT_LINE width of longest output line
- * 60 <= MAX_PRINT_LINE
- *
- * STACK_SIZE maximum number of simultaneous input sources
- *
- * MAX_IN_OPEN maximum number of input files and error insertions simul.
- *
- * FONT_MAX max internal font number
- * FONT_MAX < MAX_QUATERWORD and FONT_MAX < FONT_BASE+256
- *
- * FONT_MEM_SIZE max # of words of font info
- *
- * PARAM_SIZE max # of simultaneous macro params
- *
- * NEST_SIZE max # of semantic nestings
- *
- * MAX_STRINGS max # of string
- * MAX_STRING < MAX_HALFWORD
- *
- * STRING_VACANCIES min # of chars for user after TeX error message/fonts
- * names etc.
- *
- * POOL_SIZE max # of chars in strings
- *
- * SAVE_SIZE space for saving values outside of current group
- * SAVE_SIZE < MAX_HALFWORD
- *
- * TRIE_SIZE space for hyph patters (large for initex)
- *
- * DVI_BUF_SIZE output buffer, must be multiple of 8
- *
- * FILE_NAME_SIZE max filename size
- *
- * MEM_TOP largest index in mem array dumped by initex < MEM_MAX
- *
- * HASH_SIZE max # of control sequences, shoule be around
- * (MEM_MAX)/10
- *
- * HASH_PRIME prime # equal to or about 85% of HASH_SIZE
- *
- * HYPH_SIZE another prime, the number of hyph. exceptions
- *
- */
-
- #define BUF_SIZE 500
- #define DVI_BUF_SIZE 4096
- #define HALF_BUF 2048
- #define ERROR_LINE 64
- #define HALF_ERROR_LINE 32
- #ifdef atarist
- #define FILE_NAME_SIZE 64
- #else
- #define FILE_NAME_SIZE 104
- #endif
- #define FONT_BASE 0
- #define FONT_MAX 150
- #define FONT_MEM_SIZE 25000
- #define HASH_SIZE 3000
- #define HASH_PRIME 2551
- #define HYPH_SIZE 307
- #define MAX_IN_OPEN 15
- #define MAX_PRINT_LINE 72
- #define MAX_STRINGS 4400
- #define NEST_SIZE 40
- #define PARAM_SIZE 30
- #define POOL_SIZE 32000
- #define SAVE_SIZE 600
- #define STACK_SIZE 200
- #define STRING_VACANCIES 1000
- #define TRIE_OP_HASH_SIZE 512
- #define TRIE_SIZE 8000
-
- #ifdef BIG
- #define MEM_BOT 0
- #define MEM_TOP 50000
- #define TOK_BOT 0
- #define TOK_TOP 30000
- #ifdef INIT
- #define MEM_MIN MEM_BOT
- #define MEM_MAX MEM_TOP
- #define TOK_MIN TOK_BOT
- #define TOK_MAX TOK_TOP
- #else
- #define MEM_MIN 0
- #define MEM_MAX 55000
- #define TOK_MIN 0
- #define TOK_MAX 55000
- #endif
- #define MIN_QUARTERWORD 0
- #define MAX_QUARTERWORD 255
- #define MIN_HALFWORD 0
- #define MAX_HALFWORD 65535
- #endif /* BIG */
-
- #ifdef BIGG
- #define MEM_BOT 0
- #define MEM_TOP 250000
- #define TOK_BOT 0
- #define TOK_TOP 30000
- #ifdef INIT
- #define MEM_MIN MEM_BOT
- #define MEM_MAX MEM_TOP
- #define TOK_MIN TOK_BOT
- #define TOK_MAX TOK_TOP
- #else
- #define MEM_MIN 0
- #define MEM_MAX 524200
- #define TOK_MIN 0
- #define TOK_MAX 55000
- #endif
- #define MIN_QUARTERWORD 0
- #define MAX_QUARTERWORD 255
- #define MIN_HALFWORD 0
- #define MAX_HALFWORD 655350
- #endif /* BIGG */
-
- #if !defined(BIGG) && !defined(BIG)
- #define MEM_BOT 0
- #define MEM_TOP 30000
- #define TOK_BOT 0
- #define TOK_TOP 30000
- #ifdef INIT
- #define MEM_MIN MEM_BOT
- #define MEM_MAX MEM_TOP
- #define TOK_MIN TOK_BOT
- #define TOK_MAX TOK_TOP
- #else
- #define MEM_MIN 0
- #define MEM_MAX 55000
- #define TOK_MIN 0
- #define TOK_MAX 45000
- #endif
- #define MIN_QUARTERWORD 0
- #define MAX_QUARTERWORD 255
- #define MIN_HALFWORD 0
- #define MAX_HALFWORD 65535
- #endif
-
- /*
- * types in the outer block
- */
-
- #define global extern
- #if defined(BIG) || defined(BIGG)
- typedef unsigned char qword;
- typedef unsigned long hword;
- #else
- typedef unsigned char qword;
- typedef unsigned short hword;
- #endif
- typedef unsigned char ascii;
- typedef int bool;
- typedef unsigned char byte;
- typedef char * chrs;
- typedef int fnt;
- typedef unsigned char gord;
- typedef float gratio;
- typedef int group;
- typedef hword ptr;
- typedef long scal;
- typedef hword str;
- typedef hword tok;
- typedef long val;
- typedef FILE *word_file;
- typedef FILE *alpha_file;
- typedef FILE *byte_file;
- typedef union {
- struct {
- hword rh;
- hword lh;
- } hh1;
- struct {
- hword rh;
- qword b0;
- qword b1;
- } hh2;
- } hh;
- typedef struct {
- qword b0;
- qword b1;
- qword b2;
- qword b3;
- } qqqq;
- typedef union {
- hh hh;
- qqqq qqqq;
- long i;
- gratio gr;
- } mword;
-
- /*
- * variables in the outer block
- */
-
- global char banner[];
- global int ready_already;
-
- /*
- * functions in the outer block
- */
-
- int final_cleanup();
- int close_files_and_terminate();
- int initialize();
- bool decode_args();
- int call_edit();
- #ifdef atarist
- void handle_int();
- #else
- int handle_int();
- #endif
- /*
- * some common programming idioms
- */
-
- #define sc i
- #define incr(i) ++(i)
- #define decr(i) --(i)
- #define odd(i) ((i) & 1)
- #define abs(i) ((i) >= 0 ? (i) : -(i))
- #define round(x) (long) ((x) > 0.0 ? ((x) + 0.5) : ((x) - 0.5))
- #define negate(x) (x) = -(x)
- #define loop while (1)
- #include "cmds.h"
- #include "char.h"
- #include "str.h"
- #include "io.h"
- #include "print.h"
- #include "error.h"
- #include "heap.h"
- #include "eq.h"
- #include "hash.h"
- #include "arith.h"
-